package com.itheima.service;

import com.itheima.pojo.User;
import org.springframework.stereotype.Service;

import java.text.SimpleDateFormat;
import java.util.Date;

@Service
public class UserService {
    /**
     * 补充完成以下方法，如果用户的生日的星期数和今天一致，就是幸运用户
     */
    public Boolean isLucky(User user){
        Boolean a;
        Date Date=user.getBirthday();                   //生日获取
        Date Datenow=new Date();                        //当前时间获取
        SimpleDateFormat dateFm=new SimpleDateFormat("EEEE");   //定义时间格式
        SimpleDateFormat DateFB=new SimpleDateFormat("EEEE");
        String currSun=dateFm.format(Datenow);
        String currSunB=DateFB.format(Date);
        System.out.println(currSun);
        System.out.println(currSunB);
        if(currSun.equals(currSunB)) {
           a=true;
        }
        else
            a=false;
        return a;
    }
}
